package com.chii.auth.client;


import com.chii.auth.client.impl.UserClientFallback;
import com.chii.auth.po.ResponeInfo;
import com.chii.auth.po.Role;
import com.chii.auth.po.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "sc-user", fallback = UserClientFallback.class)
public interface UserClient {

    @RequestMapping(value = "/getUserByUsername/{username}", method = RequestMethod.GET)
    ResponeInfo<User> getUserByUsernameFromUser(@PathVariable("username") String username);

    @RequestMapping(value = "/getRoleByUserId/{userId}", method = RequestMethod.GET)
    ResponeInfo<List<Role>> getRoleByUserIdFromUser(@PathVariable("userId") Integer userId);

    @RequestMapping(value = "/user", method = RequestMethod.POST)
    ResponeInfo<List<Role>> insertNewUser(@RequestParam("username") String username, @RequestParam("password") String password);

  }